package com.zjuee.web.company.service.impl.handledata;

import com.zjuee.core.translation.handledata.impl.AbstractDataHandler;
import com.zjuee.service.company.vo.CompanyLicenseVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author wu liang
 * @since 2020/10/10 14:30
 */
@Component(value = "companyLicenseListHandle")
public class CompanyLicenseListHandle extends AbstractDataHandler {

    @Override
    public <T> T getData(T data, Map<Object,Object> map, String... str) {
        CompanyLicenseVo licenseVo = (CompanyLicenseVo) data;
       if (StringUtils.isNotBlank(licenseVo.getBclgDisposalType()) &&
               StringUtils.isNotBlank(licenseVo.getBclgDisposalStype())){
            licenseVo.setBclgDisposalTypeCN(map.get(licenseVo.getBclgDisposalType() + "" + str[0]) == null?""
                    : map.get(licenseVo.getBclgDisposalType() + "" + str[0]).toString());

            licenseVo.setBclgDisposalStypeCN(map.get(licenseVo.getBclgDisposalStype() + "" + str[1]) == null?""
                    : map.get(licenseVo.getBclgDisposalStype() + "" + str[1]).toString());
        } else {
           if(StringUtils.isNotBlank(licenseVo.getBclgDisposalType())){
               licenseVo.setBclgDisposalTypeCN(map.get(licenseVo.getBclgDisposalType() + "" + str[0]) == null?""
                       : map.get(licenseVo.getBclgDisposalType() + "" + str[0]).toString());
           }else if(StringUtils.isNotBlank(licenseVo.getBclgDisposalStype())){
               licenseVo.setBclgDisposalStypeCN(map.get(licenseVo.getBclgDisposalStype() + "" + str[0]) == null?""
                       : map.get(licenseVo.getBclgDisposalStype() + "" + str[0]).toString());
           }
        }


        return (T) licenseVo;
    }
}
